package me.arraylist.demo.a01arraylistdemo1;

import java.util.ArrayList;

public class Test1 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();

        list.add("aaa");

        list.add("bbb");

        list.add("ccc");
        list.set(1,"www");
        list.remove(1);
        String s = list.get(1);
        System.out.println(s);
        System.out.print("[");
        for (int i = 0; i < list.size(); i++) {

            if (i == list.size() - 1) {
                System.out.print(list.get(i));
            } else {
                System.out.print(list.get(i) + ",");
            }

        }

        System.out.println("]");
    }
}